imcontextsimple: Add a profiler mark for IO
authorMatthias Clasen <mclasen@redhat.com>
Thu, 2 Apr 2020 12:24:01 +0000 (08:24 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 2 Apr 2020 13:02:05 +0000 (09:02 -0400)
We are loading a file here, thankfully in a thread, but
we do it every time an entry is created. Add a profiler
mark, to make this visible.

gtk/gtkimcontextsimple.c

index a96b3f0646cd7c863825d0cedfac6f9d6087a4f8..51229a54dc74002cc4915520a5c307b1e566e232 100644 (file)
@@ -44,6 +44,7 @@
 
 #include "gtkimcontextsimpleprivate.h"
 #include "gtkimcontextsimpleseqs.h"
+#include "gdk/gdkprofilerprivate.h"
 
 /**
  * SECTION:gtkimcontextsimple
@@ -244,12 +245,17 @@ init_compose_table_thread_cb (GTask            *task,
                               gpointer          task_data,
                               GCancellable     *cancellable)
 {
+  guint64 before = g_get_monotonic_time ();
+
   if (g_task_return_error_if_cancelled (task))
     return;
 
   g_return_if_fail (GTK_IS_IM_CONTEXT_SIMPLE (task_data));
 
   gtk_im_context_simple_init_compose_table (GTK_IM_CONTEXT_SIMPLE (task_data));
+
+  if (GDK_PROFILER_IS_RUNNING)
+    gdk_profiler_end_mark (before, "im compose table load (thread)", NULL);
 }
 
 static void